﻿using System;
using System.Windows.Forms;
using SistemaFinanceiro.classes.core;
using SistemaFinanceiro.gui;

namespace SistemaFinanceiro
{
    public partial class FrmPrincipal : Form
    {
        Fachada fachada = Fachada.Instancia;

        public FrmPrincipal()
        {
            InitializeComponent();
        }

        private void cartãoToolStripMenuItem_Click_1(object sender, EventArgs e)
        {
            new FrmCartao().ShowDialog();
        }

        private void FrmPrincipal_FormClosed(object sender, FormClosedEventArgs e)
        {
            if (fachada.UsuarioLogado != null)
            {
                FormCollection forms = Application.OpenForms;
                forms["FrmLogin"].Close();
            }
        }

        private void sairToolStripMenuItem_Click(object sender, EventArgs e)
        {
            fachada.DesautenticarUsuario();
            
            FormCollection forms = Application.OpenForms;
            forms["FrmLogin"].Show();
            Close();
        }

        private void rendimentosToolStripMenuItem_Click(object sender, EventArgs e)
        {
            new FrmRenda().ShowDialog();
        }
    }
}
